package lanou.autohome.findcar.adapters;

import android.content.Context;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

import java.util.ArrayList;

import lanou.autohome.R;

/**
 * Created by dllo on 16/8/25.
 */
public class BrandLvRightAdapter extends BaseAdapter{

    Context context;
    private ArrayList<String> titleStr;

    public BrandLvRightAdapter(Context context) {
        this.context = context;
    }

    public void setTitleStr(ArrayList<String> titleStr) {
        this.titleStr = titleStr;
//        notifyDataSetChanged();
    }

    @Override
    public int getCount() {
        return titleStr != null ? titleStr.size() : 0;
    }

    @Override
    public Object getItem(int position) {
        return null;
    }

    @Override
    public long getItemId(int position) {
        return 0;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {

        LayoutInflater inflater = LayoutInflater.from(context);
        Log.d("BrandLvRightAdapter", titleStr.get(position));
        if(convertView == null){
            convertView = inflater.inflate(R.layout.item_findcar_brand_lvright, null);
        }
            TextView titletv = (TextView) convertView.findViewById(R.id.textview_lvright_brand_findcar);
            titletv.setText(titleStr.get(position));
        return convertView;
    }
}
